'''
start all spiders
'''
import subprocess
import sys

#count of spiders

count=int(sys.argv[1]) if len(sys.argv)>=2 else 10

p=[]
for rank in range(3, 3+count):
	#f=open("out%d.txt" % rank, "w+")
	#proc = subprocess.Popen("python superspider.py %d" % rank, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr=subprocess.PIPE, shell = True)
	proc = subprocess.Popen("python superspider.py %d" % rank, shell = True)
	p.append(proc)
	print count, "start rank: ", rank
	
print count, "spiders started"